﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Basic test app</title>
    <base href="/subdir/" />
</head>
<body>
  <div id="test-selector" style="display: none;">
    Select test:
    <select onchange="mountTestComponent(event.target.value)">
      <option value="">Choose...</option>
      <option value="BasicTestApp.AddRemoveChildComponents">Add/remove child components</option>
      <option value="BasicTestApp.CounterComponent">Counter</option>
      <option value="BasicTestApp.CounterComponentUsingChild">Counter using child component</option>
      <option value="BasicTestApp.CounterComponentWrapper">Counter wrapped in parent</option>
      <option value="BasicTestApp.KeyPressEventComponent">Key press event</option>
      <option value="BasicTestApp.ParentChildComponent">Parent component with child</option>
      <option value="BasicTestApp.PropertiesChangedHandlerParent">Parent component that changes parameters on child</option>
      <option value="BasicTestApp.RedTextComponent">Red text</option>
      <option value="BasicTestApp.RenderFragmentToggler">Render fragment renderer</option>
      <option value="BasicTestApp.TextOnlyComponent">Plain text</option>
      <option value="BasicTestApp.HierarchicalImportsTest.Subdir.ComponentUsingImports">Imports statement</option>
      <option value="BasicTestApp.HttpClientTest.HttpRequestsComponent">HttpClient tester</option>
      <option value="BasicTestApp.BindCasesComponent">@bind cases</option>
      <option value="BasicTestApp.ExternalContentPackage">External content package</option>
      <!--<option value="BasicTestApp.RouterTest.Default">Router</option> Excluded because it requires additional setup to work correctly when loaded manually -->
    </select>
    &nbsp;
    <span id="source-info"></span>
    <hr />
  </div>

  <app>Loading...</app>

  <script type="blazor-boot"></script>
  <script>
    // The client-side .NET code calls this when it is ready to be called from test code
    // The Xunit test code polls until it sees the flag is set
    Blazor.registerFunction('testReady', function () {
        window.isTestReady = true;
        document.getElementsByTagName('APP')[0].textContent = '';
        document.getElementById('test-selector').style.display = 'block';
    });

    // The Xunit test code calls this when setting up tests for specific components
    function mountTestComponent(typeName) {
      document.getElementById('source-info').innerHTML = '<code><tt>' + typeName.replace(/\./g, '/') + '.cshtml</code></strong>';
      var method = Blazor.platform.findMethod('BasicTestApp', 'BasicTestApp', 'Program', 'MountTestComponent');
      Blazor.platform.callMethod(method, null, [Blazor.platform.toDotNetString(typeName)]);
    }
  </script>
</body>
</html>
